namespace CosyTrade.UI
{
    public class MenuItemCollection : System.Collections.Generic.SortedList<int, IMenuItem>
    {
        private readonly IMenuItem parentMenuItem;

        public MenuItemCollection(IMenuItem parentMenuItem)
        {
            this.parentMenuItem = parentMenuItem;
        }

        public void Add(IMenuItem item)
        {
            item.Parent = parentMenuItem;
            Add(item.OrderIndex, item);
        }
    }
}